home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wcomm111.zip / TC.ZIP / TERM.C < prev    next >
C/C++ Source or Header  |  1991-02-02  |  1KB  |  40 lines

  1. //          Warp Communications Library
  2. //          Copyright (C) 1991 Trevor Bell, All Rights Reserved
  3.  
  4. #include <conio.h>
  5. #include <stdio.h>
  6. #include <process.h>
  7. #include "warpcomm.h"
  8.  
  9. int main (void)
  10. {
  11.     char ch = 0, ch2 = 0;
  12.  
  13.     clrscr ();
  14.     cputs ("A simple terminal program for the Warp Communications Library (Ctrl-C to exit)\r\n");
  15.     cputs ("Copyright (C) 1991 Trevor Bell, All Rights Reserved\r\n\n");
  16.  
  17.     com_open (0, 2400, 4, 0x3F8, 2000, 2000);
  18.     /* opens com port 1 at 2400 baud, IRQ 4, base address 3F8 (hex) with
  19.      2000 byte transmit and receive buffers */
  20.  
  21.     send_modem_string (0, "ATZ|");
  22.     /* initializes the modem */
  23.  
  24.  
  25.     while (ch != 3) {
  26.         if (kbhit ()) {            /* check the keyboard for a keypress */
  27.             ch = getch ();         /* get the keypress */
  28.             com_out_char (0, ch);     /* send the keypress to the modem */
  29.         }
  30.         if (char_waiting (0)) {
  31.             /* check to see if the modem has a character waiting */
  32.  
  33.             ch2 = com_get_char (0); /* get the character from the com port */
  34.             putch (ch2);           /* print the character on the screen */
  35.         }
  36.     }
  37.     com_close (0);                  /* close the com port */
  38.     exit (0);                      /* exit with errorlevel 0 */
  39. }
  40.